/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function (nums, target) {
    let len = nums.length
    for (let i = 0; i < len; i++) {
        for (let j = i + 1; j < len; j++) {
            let num = nums[i] + nums[j]
            if (num == target) {
                return [i, j]
            }
        }
    }
};

; (function () {
    //return
    var twoSum = function (nums, target) {
        let numset = {};
        var _length = nums.length;
        for (let i = 0; i < _length; i++) {
            if (numset[target - nums[i]] != undefined) {
                let o = [numset[target - nums[i]], i];
                return o;
            }
            else
                numset[nums[i]] = i;
        }
    };
})();